home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / MPW / gzip 1.2.2 / cextras-1.0 / stat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-11  |  3.2 KB  |  101 lines  |  [TEXT/ALFA]

  1. /*
  2.     stat.h -- an attempt to provide somewhat compatible stat functions
  3.               for MPW.
  4.     
  5.     stat & fstat return:
  6.         
  7.         -1 on failure and sets errno.
  8.         0 on success
  9.  
  10.     Copyright (c) 1993 Anthony C. Ard.
  11.  
  12.     This program is free software; you can redistribute it and/or
  13.     modifiy it under the terms of the GNU General Public License
  14.     as published by the Free Software Foundation; either version 2
  15.     of the License, or (at your option) any later version.
  16.     
  17.     This program is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20.     GNU General Public License for more details.
  21.     
  22.     You should have received a copy of the GNU General Public License
  23.     along with this program; if not, write to the Free Software
  24.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  25. */
  26.  
  27. #ifndef __STAT_HEADER__
  28. #define __STAT_HEADER__
  29.  
  30. #include <time.h>
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. struct stat
  37. {
  38.     dev_t            st_dev;        /* MacOS volume reference number */
  39.     ino_t            st_ino;        /* MacOS directory id or file number */
  40.     unsigned short     st_mode;
  41.     short            st_nlink;    /* Not used */
  42.     short            st_uid;        /* Not used */
  43.     short            st_gid;        /* Not used */
  44.     dev_t            st_rdev;    /* Not used */
  45.     off_t            st_size;
  46.     time_t            st_atime;    /* MacOS Modification date */
  47.     time_t            st_crtime;    /* MacOS Creation date */
  48.     time_t            st_mtime;    /* MacOS Modification date */
  49.     time_t            st_bktime;    /* MacOS Backup date */
  50.     time_t            st_ctime;    /* MacOS Modification date */
  51.     int                st_spare3;
  52.     long            st_blksize;
  53.     long            st_blocks;
  54.     long            st_spare4[2];
  55. };
  56.  
  57. #define S_IFMT        0xF000    /* type of file */
  58.  
  59. #define S_IFDIR        0x4000    /* directory */
  60. #define S_IFCHR        0x2000    /* character special */
  61. #define S_IFBLK        0x6000    /* block special */
  62. #define S_IFREG        0x8000    /* regular */
  63. #define S_IFLNK        0xA000    /* symbolic link */
  64. #define S_IFSOCK    0xC000    /* socket */
  65. #define S_IFIFO        0x1000    /* fifo */
  66.  
  67. #define S_ISUID        0x0800    /* set user id on execution */
  68. #define S_ISGID        0x0400    /* set group id on execution */
  69. #define S_ISVTX        0x0200    /* save swapped text even after use */
  70. #define S_IREAD        0x0100    /* read permission, owner */
  71. #define S_IWRITE    0x0080    /* write permission, owner */
  72. #define S_IEXEC        0x0040    /* execute/search permission, owner */
  73.  
  74. #define    S_IRUSR        0x0100    /* read permission, owner */
  75. #define    S_IWUSR        0x0080    /* write permission, owner */
  76. #define    S_IXUSR        0x0040    /* execute/search permission, owner */
  77. #define    S_IRGRP        0x0020    /* read permission, group */
  78. #define    S_IWGRP        0x0010    /* write permission, grougroup */
  79. #define    S_IXGRP        0x0008    /* execute/search permission, group */
  80. #define    S_IROTH        0x0004    /* read permission, other */
  81. #define    S_IWOTH        0x0002    /* write permission, other */
  82. #define    S_IXOTH        0x0001    /* execute/search permission, other */
  83. #define    S_ENFMT        0x0000    /* enforcement-mode locking not implemented */
  84.  
  85. #define    S_ISBLK(m)    (((m)&S_IFMT) == S_IFBLK)
  86. #define    S_ISCHR(m)    (((m)&S_IFMT) == S_IFCHR)
  87. #define    S_ISDIR(m)    (((m)&S_IFMT) == S_IFDIR)
  88. #define    S_ISFIFO(m)    (((m)&S_IFMT) == S_IFIFO)
  89. #define    S_ISREG(m)    (((m)&S_IFMT) == S_IFREG)
  90. #define    S_ISLNK(m)    (((m)&S_IFMT) == S_IFLNK)
  91. #define    S_ISSOCK(m)    (((m)&S_IFMT) == S_IFSOCK)
  92.  
  93. int stat( const char *, struct stat * );
  94. int fstat( int, struct stat * );
  95.  
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99.  
  100. #endif
  101.